#include <iostream>
#include <thread>
#include <mutex>

std::mutex mtx;
int shared_variable=0;

void increment()
{
    for(int i=0;i<100;i++)
    {
        std::lock_guard<std::mutex> lock(mtx);
        ++shared_variable;
    }
}

int main()
{
    std::thread t1(increment);
    std::thread t2(increment);
    t1.join();
    t2.join();
    std::cout<<"Shared variable: "<<shared_variable<<std::endl;
    return 0;
}